<?php

echo <<< EOQ
    <table cellspacing="10" cellpadding="5">
      <tr>
        <th>Date</th>
        <td align="center">
          <select name="day">
EOQ;
    for($dayCounter = 1; $dayCounter < 32; $dayCounter++) {
      echo "<option value=\"$dayCounter\"";
      if ($day == $dayCounter) {
        echo " selected";
      }
      echo ">$dayCounter</option>\n";
    }
echo <<< EOQ
          </select>
        </td>
        <td align="center">
          <select name="month">
EOQ;
    for($monthCounter = 1; $monthCounter <= 12; $monthCounter++) {
      $value = $months[$monthCounter -1];
      echo "<option value=\"$monthCounter\"";
      if ($monthCounter == $month) {
        echo " selected";
      }
      echo ">$value</option>\n";
    }
echo <<< EOQ
          </select>
        </td>
        <td align="center">
          <select name="year">
EOQ;
    for($yearCounter = 2001; $yearCounter < 2010; $yearCounter++) {
      echo "<option value=\"$yearCounter\"";
      if ($year == $yearCounter) {
        echo " selected";
      }
      echo ">$yearCounter</option>\n";
    }
echo <<< EOQ
          </select>
        </td>
      </tr>
    </table>
EOQ;
?>